package com.googlecode.wmbruby;
import java.util.ArrayList;
import java.util.List;


public class MbElement {

    private List<MbElement> children = new ArrayList<MbElement>();
    private String name;
    private Object value;

	public MbElement(String name) {
        this.name = name;
    }
	
	public MbElement(String name, String value) {
        this.name = name;
        this.value = value;
    }
    
    public void addChild(MbElement elm) {
        children.add(elm);
    }
    
    public Object getValue() {
    	return value;
    }
    
    public void setValue(Object value) {
    	this.value = value;
    }
    
    public MbElement getChildByName(String name) {
        for (MbElement elm : children) {
            if(elm.getName().equals(name)) {
                return elm;
            }
        }
        
        return null;
    }

    public String getName() {
        return name;
    }

    public String fooString() {
        // TODO Auto-generated method stub
        return name;
    }
}
